#include "favoritesedit.h"

FavoritesEdit::FavoritesEdit(QWidget *parent) : QMainWindow(parent), favEdit(new Ui::FavoritesEdit)
{
    favEdit->setupUi(this);

    //Set to false to ensure at launch that neither a current, existing, or new favorite is selected
    currentFavoriteSet = false;
    existingFavoriteSet = false;
    newFavoriteSet = false;

    readFavoritesEditSettings();

    //Favorites Edit Signals
    connect(favEdit->useExisting_TableWidget, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(useExistingFavoriteSelected(int, int)));
    connect(favEdit->useExisting_TableWidget, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(setExistingDefaultButtons()));
    connect(favEdit->useExistingTest_Button, SIGNAL(clicked()), this, SLOT(testExistingPath()));
    connect(favEdit->useExistingSave_Button, SIGNAL(clicked()), this, SLOT(setNewFavoriteForChange()));
    connect(favEdit->applyFavoritesChanges_Button, SIGNAL(clicked()), this, SLOT(applyNewFavoriteChanges()));
    connect(favEdit->useExisting_LineEdit, SIGNAL(textEdited(QString)), this, SLOT(editExistingFavorite()));
    connect(favEdit->useExistingTestEdit_Button, SIGNAL(clicked()), this, SLOT(testEditedExistingPath()));
    connect(favEdit->useExistingSaveEdit_Button, SIGNAL(clicked()), this, SLOT(saveEditedExistingPath()));
    connect(favEdit->newApplicationPath_LineEdit, SIGNAL(textChanged(QString)), this, SLOT(testNewFavorite()));
    connect(favEdit->newWebsitePath_LineEdit, SIGNAL(textEdited(QString)), this, SLOT(testNewFavorite()));
    connect(favEdit->new_TableWidget, SIGNAL(currentCellChanged(int,int,int,int)), this, SLOT(useNewFavoriteSelected(int, int)));
}

void FavoritesEdit::setQuickPointer(QuickLaunch *quick)
{
    setQuickLaunch = quick;
}

void FavoritesEdit::readFavoritesEditSettings()
{
    QSettings FavoritesEditSettings("LifeSync", "Project LifeSync");

    //Current Favorites: Image Load Settings
    favEdit->currentFavoriteOne_Button->setStyleSheet(FavoritesEditSettings.value("currentFavOne", "QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/firefox.png)}").toString());
    favEdit->currentFavoriteTwo_Button->setStyleSheet(FavoritesEditSettings.value("currentFavTwo", "QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/facebook.png)}").toString());
    favEdit->currentFavoriteThree_Button->setStyleSheet(FavoritesEditSettings.value("currentFavThree", "QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/email.png)}").toString());
    favEdit->currentFavoriteFour_Button->setStyleSheet(FavoritesEditSettings.value("currentFavFour", "QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/word.png)}").toString());
    favEdit->currentFavoriteFive_Button->setStyleSheet(FavoritesEditSettings.value("currentFavFive", "QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/powerpoint.png)}").toString());
    favEdit->currentFavoriteSix_Button->setStyleSheet(FavoritesEditSettings.value("currentFavSix", "QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/excel.png)}").toString());

    //Current Favorites: Current Change Display Load Settings
    favEdit->currentFavoriteOneHidden_Label->setText(FavoritesEditSettings.value("favChangeOne", "firefox").toString());
    favEdit->currentFavoriteTwoHidden_Label->setText(FavoritesEditSettings.value("favChangeTwo", "facebook").toString());
    favEdit->currentFavoriteThreeHidden_Label->setText(FavoritesEditSettings.value("favChangeThree", "email").toString());
    favEdit->currentFavoriteFourHidden_Label->setText(FavoritesEditSettings.value("favChangeFour", "word").toString());
    favEdit->currentFavoriteFiveHidden_Label->setText(FavoritesEditSettings.value("favChangeFive", "powerpoint").toString());
    favEdit->currentFavoriteSixHidden_Label->setText(FavoritesEditSettings.value("favChangeSix", "excel").toString());

    //Current Favorites: Path Load Settings
    favEdit->currentFavoriteOnePathHidden_Label->setText(FavoritesEditSettings.value("favPathOne", "A:/Program Files/Mozilla Firefox/firefox.exe").toString());
    favEdit->currentFavoriteTwoPathHidden_Label->setText(FavoritesEditSettings.value("favPathTwo", "A:/Program Files/Internet Explorer/iexplore.exe").toString());
    favEdit->currentFavoriteThreePathHidden_Label->setText(FavoritesEditSettings.value("favPathThree", "https://webmail.fredonia.edu").toString());
    favEdit->currentFavoriteFourPathHidden_Label->setText(FavoritesEditSettings.value("favPathFour", "A:/Program Files/Microsoft Office/Office12/WINWORD").toString());
    favEdit->currentFavoriteFivePathHidden_Label->setText(FavoritesEditSettings.value("favPathFive", "A:/Program Files/Microsoft Office/Office12/POWERPNT").toString());
    favEdit->currentFavoriteSixPathHidden_Label->setText(FavoritesEditSettings.value("favPathSix", "A:/Program Files/Microsoft Office/Office12/EXCEL").toString());

    //Existing Favorites: Path Load Settings
    firefox = FavoritesEditSettings.value("favFireFox", "A:/Program Files/Mozilla Firefox/firefox.exe").toString();
    ie = FavoritesEditSettings.value("favIE", "A:/Program Files/Internet Explorer/iexplore.exe").toString();
    aim = FavoritesEditSettings.value("favAIM", "C:/Program Files/AIM/aim.exe").toString();
    msn = FavoritesEditSettings.value("favMSN", "A:/Program Files/Windows Live/Messenger/msnmsgr.exe").toString();
    pidgin = FavoritesEditSettings.value("favPidgin", "C:/Program Files/Pidgin/pidgin.exe").toString();
    skype = FavoritesEditSettings.value("favSkype", "A:/Program Files/Skype/Phone/Skype.exe").toString();
    vlc = FavoritesEditSettings.value("favVLC", "C:/Program Files/VideoLAN/VLC/vlc.exe").toString();
    wmp = FavoritesEditSettings.value("favWMP", "C:/Program Files/Windows Media Player/wmplayer.exe").toString();
    itunes = FavoritesEditSettings.value("favItunes", "A:/Program Files/iTunes/iTunes.exe").toString();
    quicktime = FavoritesEditSettings.value("favQuicktime", "A:/Program Files/QuickTime/QuickTimePlayer.exe").toString();
    word = FavoritesEditSettings.value("favWord", "C:/Program Files/Microsoft Office/Office12/WINWORD").toString();
    powerpoint = FavoritesEditSettings.value("favPowerpoint", "A:/Program Files/Microsoft Office/Office12/POWERPNT").toString();
    excel = FavoritesEditSettings.value("favExcel", "C:/Program Files/Microsoft Office/Office12/EXCEL").toString();

    //New Favorites: New Table User Setup Load Settings
    newCustomCount = FavoritesEditSettings.value("customCounter", 0).toInt();
    newRow = FavoritesEditSettings.value("newRow", 0).toInt();
    newFavPathOne = FavoritesEditSettings.value("newFavPathOne").toString();
    newFavPathTwo = FavoritesEditSettings.value("newFavPathTwo").toString();
    newFavPathThree = FavoritesEditSettings.value("newFavPathThree").toString();
    newFavPathFour = FavoritesEditSettings.value("newFavPathFour").toString();
    newFavIconOne = FavoritesEditSettings.value("newFavIconOne").toString();
    newFavIconTwo = FavoritesEditSettings.value("newFavIconTwo").toString();
    newFavIconThree = FavoritesEditSettings.value("newFavIconThree").toString();
    newFavIconFour = FavoritesEditSettings.value("newFavIconFour").toString();

    //New Favorites: New Table Item Load Settings
    QTableWidgetItem *newItem1 = new QTableWidgetItem;
    favEdit->new_TableWidget->setItem(0, 0 , newItem1);
    favEdit->new_TableWidget->item(0, 0)->setText(FavoritesEditSettings.value("newItemTextOne").toString());
    favEdit->new_TableWidget->item(0, 0)->setIcon(FavoritesEditSettings.value("newItemIconOne").value<QIcon>());
    QTableWidgetItem *newItem2 = new QTableWidgetItem;
    favEdit->new_TableWidget->setItem(1, 0 , newItem2);
    favEdit->new_TableWidget->item(1, 0)->setText(FavoritesEditSettings.value("newItemTextTwo").toString());
    favEdit->new_TableWidget->item(1, 0)->setIcon(FavoritesEditSettings.value("newItemIconTwo").value<QIcon>());
    QTableWidgetItem *newItem3 = new QTableWidgetItem;
    favEdit->new_TableWidget->setItem(2, 0 , newItem3);
    favEdit->new_TableWidget->item(2, 0)->setText(FavoritesEditSettings.value("newItemTextThree").toString());
    favEdit->new_TableWidget->item(2, 0)->setIcon(FavoritesEditSettings.value("newItemIconThree").value<QIcon>());
    QTableWidgetItem *newItem4 = new QTableWidgetItem;
    favEdit->new_TableWidget->setItem(3, 0 , newItem4);
    favEdit->new_TableWidget->item(3, 0)->setText(FavoritesEditSettings.value("newItemTextFour").toString());
    favEdit->new_TableWidget->item(3, 0)->setIcon(FavoritesEditSettings.value("newItemIconFour").value<QIcon>());

    //New Favorites: New Favorite Website Check Load Settings
    websiteFavOne = FavoritesEditSettings.value("websiteFavOne").toBool();
    websiteFavTwo = FavoritesEditSettings.value("websiteFavTwo").toBool();
    websiteFavThree = FavoritesEditSettings.value("websiteFavThree").toBool();
    websiteFavFour = FavoritesEditSettings.value("websiteFavFour").toBool();
}

void FavoritesEdit::writeFavoritesEditSettings()
{
    QSettings FavoritesEditSettings("LifeSync", "Project LifeSync");

    //Current Favorites: Image Save Settings
    FavoritesEditSettings.setValue("currentFavOne", favEdit->currentFavoriteOne_Button->styleSheet());
    FavoritesEditSettings.setValue("currentFavTwo", favEdit->currentFavoriteTwo_Button->styleSheet());
    FavoritesEditSettings.setValue("currentFavThree", favEdit->currentFavoriteThree_Button->styleSheet());
    FavoritesEditSettings.setValue("currentFavFour", favEdit->currentFavoriteFour_Button->styleSheet());
    FavoritesEditSettings.setValue("currentFavFive", favEdit->currentFavoriteFive_Button->styleSheet());
    FavoritesEditSettings.setValue("currentFavSix", favEdit->currentFavoriteSix_Button->styleSheet());

    //Current Favorites: Current Change Display Save Settings
    FavoritesEditSettings.setValue("favChangeOne", favEdit->currentFavoriteOneHidden_Label->text());
    FavoritesEditSettings.setValue("favChangeTwo", favEdit->currentFavoriteTwoHidden_Label->text());
    FavoritesEditSettings.setValue("favChangeThree", favEdit->currentFavoriteThreeHidden_Label->text());
    FavoritesEditSettings.setValue("favChangeFour", favEdit->currentFavoriteFourHidden_Label->text());
    FavoritesEditSettings.setValue("favChangeFive", favEdit->currentFavoriteFiveHidden_Label->text());
    FavoritesEditSettings.setValue("favChangeSix", favEdit->currentFavoriteSixHidden_Label->text());

    //Current Favorites: Path Save Settings
    FavoritesEditSettings.setValue("favPathOne", favEdit->currentFavoriteOnePathHidden_Label->text());
    FavoritesEditSettings.setValue("favPathTwo", favEdit->currentFavoriteTwoPathHidden_Label->text());
    FavoritesEditSettings.setValue("favPathThree", favEdit->currentFavoriteThreePathHidden_Label->text());
    FavoritesEditSettings.setValue("favPathFour", favEdit->currentFavoriteFourPathHidden_Label->text());
    FavoritesEditSettings.setValue("favPathFive", favEdit->currentFavoriteFivePathHidden_Label->text());
    FavoritesEditSettings.setValue("favPathSix", favEdit->currentFavoriteSixPathHidden_Label->text());

    //Existing Favorites: Path Save Settings
    FavoritesEditSettings.setValue("favFirefox", firefox);
    FavoritesEditSettings.setValue("favIE", ie);
    FavoritesEditSettings.setValue("favAIM", aim);
    FavoritesEditSettings.setValue("favMSN", msn);
    FavoritesEditSettings.setValue("favPidgin", pidgin);
    FavoritesEditSettings.setValue("favSkype", skype);
    FavoritesEditSettings.setValue("favVLC", vlc);
    FavoritesEditSettings.setValue("favWMP", wmp);
    FavoritesEditSettings.setValue("favItunes", itunes);
    FavoritesEditSettings.setValue("favQuicktime", quicktime);
    FavoritesEditSettings.setValue("favWord", word);
    FavoritesEditSettings.setValue("favPowerpoint", powerpoint);
    FavoritesEditSettings.setValue("favExcel", excel);

    //New Favorites: New Table User Setup Save Settings
    FavoritesEditSettings.setValue("customCounter", newCustomCount);
    FavoritesEditSettings.setValue("newRow", newRow);
    FavoritesEditSettings.setValue("newFavPathOne", newFavPathOne);
    FavoritesEditSettings.setValue("newFavPathTwo", newFavPathTwo);
    FavoritesEditSettings.setValue("newFavPathThree", newFavPathThree);
    FavoritesEditSettings.setValue("newFavPathFour", newFavPathFour);
    FavoritesEditSettings.setValue("newFavIconOne", newFavIconOne);
    FavoritesEditSettings.setValue("newFavIconTwo", newFavIconTwo);
    FavoritesEditSettings.setValue("newFavIconThree", newFavIconThree);
    FavoritesEditSettings.setValue("newFavIconFour", newFavIconFour);

    //New Favorites: New Table Item Save Settings
    if(favEdit->new_TableWidget->item(0, 0))
    {
    FavoritesEditSettings.setValue("newItemTextOne", favEdit->new_TableWidget->item(0, 0)->text());
    FavoritesEditSettings.setValue("newItemIconOne", favEdit->new_TableWidget->item(0, 0)->icon());
    }
    if(favEdit->new_TableWidget->item(1, 0))
    {
    FavoritesEditSettings.setValue("newItemTextTwo", favEdit->new_TableWidget->item(1, 0)->text());
    FavoritesEditSettings.setValue("newItemIconTwo", favEdit->new_TableWidget->item(1, 0)->icon());
    }
    if(favEdit->new_TableWidget->item(2, 0))
    {
    FavoritesEditSettings.setValue("newItemTextThree", favEdit->new_TableWidget->item(2, 0)->text());
    FavoritesEditSettings.setValue("newItemIconThree", favEdit->new_TableWidget->item(2, 0)->icon());
    }
    if(favEdit->new_TableWidget->item(3, 0))
    {
    FavoritesEditSettings.setValue("newItemTextFour", favEdit->new_TableWidget->item(3, 0)->text());
    FavoritesEditSettings.setValue("newItemIconFour", favEdit->new_TableWidget->item(3, 0)->icon());
    }

    //New Favorites: New Favorite Website Check Save Settings
    FavoritesEditSettings.setValue("websiteFavOne", websiteFavOne);
    FavoritesEditSettings.setValue("websiteFavTwo", websiteFavTwo);
    FavoritesEditSettings.setValue("websiteFavThree", websiteFavThree);
    FavoritesEditSettings.setValue("websiteFavFour", websiteFavFour);
}

//Depending on the row and column the appropriate item will be selected
void FavoritesEdit::useExistingFavoriteSelected(int Row, int Col)
{
    if(Col == 0)
    {
        columnNumber = 0;
        website = true;
        switch(Row)
        {
            case 0:
                existingFavoritePath = "www.facebook.com";
                existingFavoriteName = "facebook";
                setExistingFavorite_LineEdit();
                break;
            case 1:
                existingFavoritePath = "www.myspace.com";
                existingFavoriteName = "myspace";
                setExistingFavorite_LineEdit();
                break;
            case 2:
                existingFavoritePath = "www.youtube.com";
                existingFavoriteName = "youtube";
                setExistingFavorite_LineEdit();
                break;
            case 3:
                existingFavoritePath = "www.twitter.com";
                existingFavoriteName = "twitter";
                setExistingFavorite_LineEdit();
                break;
        }
    }
    if(Col == 1)
    {
        columnNumber = 1;
        switch(Row)
        {
            case 0:
                website = false;
                existingFavoritePath = firefox;
                existingFavoriteName = "firefox";
                setExistingFavorite_LineEdit();
                break;
            case 1:
                website = false;
                existingFavoritePath = ie;
                existingFavoriteName = "ie";
                setExistingFavorite_LineEdit();
                break;
            case 2:
                website = true;
                existingFavoritePath = "www.yahoo.com";
                existingFavoriteName = "yahoo";
                setExistingFavorite_LineEdit();
                break;
            case 3:
                website = true;
                existingFavoritePath = "www.ebay.com";
                existingFavoriteName = "ebay";
                setExistingFavorite_LineEdit();
                break;
        }
    }
    if(Col == 2)
    {
        columnNumber = 2;
        website = true;
        switch(Row)
        {
            case 0:
                existingFavoritePath = "www.gmail.com";
                existingFavoriteName = "gmail";
                setExistingFavorite_LineEdit();
                break;
            case 1:
                existingFavoritePath = "www.aolmail.com";
                existingFavoriteName = "aolmail";
                setExistingFavorite_LineEdit();
                break;
            case 2:
                existingFavoritePath = "www.yahoomail.com";
                existingFavoriteName = "yahoomail";
                setExistingFavorite_LineEdit();
                break;
            case 3:
                existingFavoritePath = "www.windowslive.com";
                existingFavoriteName = "windowslive";
                setExistingFavorite_LineEdit();
                break;
        }
    }
    if(Col == 3)
    {
        columnNumber = 3;
        website = false;
        switch(Row)
        {
            case 0:
                existingFavoritePath = aim;
                existingFavoriteName = "aim";
                setExistingFavorite_LineEdit();
                break;
            case 1:
                existingFavoritePath = msn;
                existingFavoriteName = "msn";
                setExistingFavorite_LineEdit();
                break;
            case 2:
                existingFavoritePath = pidgin;
                existingFavoriteName = "pidgin";
                setExistingFavorite_LineEdit();
                break;
            case 3:
                existingFavoritePath = skype;
                existingFavoriteName = "skype";
                setExistingFavorite_LineEdit();
                break;
        }
    }
    if(Col == 4)
    {
        columnNumber = 4;
        website = false;
        switch(Row)
        {
            case 0:
                existingFavoritePath = vlc;
                existingFavoriteName = "vlc";
                setExistingFavorite_LineEdit();
                break;
            case 1:
                existingFavoritePath = wmp;
                existingFavoriteName = "wmp";
                setExistingFavorite_LineEdit();
                break;
            case 2:
                existingFavoritePath = itunes;
                existingFavoriteName = "itunes";
                setExistingFavorite_LineEdit();
                break;
            case 3:
                existingFavoritePath = quicktime;
                existingFavoriteName = "quicktime";
                setExistingFavorite_LineEdit();
                break;
        }
    }
    if(Col == 5)
    {
        columnNumber = 5;
        switch(Row)
        {
           case 0:
                website = true;
                existingFavoritePath = "https://webmail.fredonia.edu";
                existingFavoriteName = "email";
                setExistingFavorite_LineEdit();
                break;
            case 1:
                website = false;
                existingFavoritePath = word;
                existingFavoriteName = "word";
                setExistingFavorite_LineEdit();
                break;
            case 2:
                website = false;
                existingFavoritePath = powerpoint;
                existingFavoriteName = "powerpoint";
                setExistingFavorite_LineEdit();
                break;
            case 3:
                website = false;
                existingFavoritePath = excel;
                existingFavoriteName = "excel";
                setExistingFavorite_LineEdit();
                break;
        }
    }
}

//Based on whether the item selected is a website or not, the line Edit will either be disabled or enabled for user editing
void FavoritesEdit::setExistingFavorite_LineEdit()
{
    if(website == true)
    {
        favEdit->useExisting_LineEdit->setEnabled(false);
        favEdit->useExisting_LineEdit->setText(existingFavoritePath);
        //websiteLink = (favEdit->useExisting_LineEdit->text());
    }
    else
    {
        favEdit->useExisting_LineEdit->setEnabled(true);
        favEdit->useExisting_LineEdit->setText(existingFavoritePath);
    }
}

//The user is able to test the paths to ensure the websites/applications work on their pc
void FavoritesEdit::testExistingPath()
{
    if(website == true)
    {
        //QDesktopServices::openUrl(QUrl(websiteLink));
        QDesktopServices::openUrl(QUrl(existingFavoritePath));
    }
    else
    {
        program = favEdit->useExisting_LineEdit->text();
        QProcess *myProcess = new QProcess();
        myProcess->start(program, arguments);

        if (myProcess->error() == QProcess::FailedToStart)
        {
            QMessageBox::critical( 0, tr("Error"), tr("Could not find the correct path to run. If the path has been updated proceed to Add New to search for the new path"), tr("Ok") );
        }
    }
}

//If the user selected an item in the existing table then the image of that item will be displayed in the change to label for viewing
void FavoritesEdit::setNewFavoriteForChange()
{
    existingSelected = true;

    favEdit->changeFavoriteReset_Button->setEnabled(true);
    existingFavoriteSet = true;
    activateApplyChangesButton();

    switch(columnNumber)
    {
        case 0:
            favEdit->newFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png")));
            break;
        case 1:
            favEdit->newFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png")));
            break;
        case 2:
            favEdit->newFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png")));
            break;
        case 3:
            favEdit->newFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png")));
            break;
        case 4:
            favEdit->newFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png")));
            break;
        case 5:
            favEdit->newFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png")));
            break;
    }
}

/*
    The functions below handle the case of when the user selects a current favorite to change

    Applies to: on_currentFavoriteOne_Button_clicked()
                on_currentFavoriteTwo_Button_clicked()
                on_currentFavoriteThree_Button_clicked()
                on_currentFavoriteFour_Button_clicked()
                on_currentFavoriteFive_Button_clicked()
                on_currentFavoriteSix_Button_clicked()
*/
void FavoritesEdit::on_currentFavoriteOne_Button_clicked()
{
   favEdit->changeFavoriteReset_Button->setEnabled(true);
   currentFavoriteSet = true;
   currentImageName = favEdit->currentFavoriteOneHidden_Label->text();
   setCurrentFavoriteForChange();
   activateApplyChangesButton();
   currentFavoriteSelected = 1;
}

void FavoritesEdit::on_currentFavoriteTwo_Button_clicked()
{
   favEdit->changeFavoriteReset_Button->setEnabled(true);
   currentFavoriteSet = true;
   currentImageName = favEdit->currentFavoriteTwoHidden_Label->text();
   setCurrentFavoriteForChange();
   activateApplyChangesButton();
   currentFavoriteSelected = 2;
}

void FavoritesEdit::on_currentFavoriteThree_Button_clicked()
{
   favEdit->changeFavoriteReset_Button->setEnabled(true);
   currentFavoriteSet = true;
   currentImageName = favEdit->currentFavoriteThreeHidden_Label->text();
   setCurrentFavoriteForChange();
   activateApplyChangesButton();
   currentFavoriteSelected = 3;
}

void FavoritesEdit::on_currentFavoriteFour_Button_clicked()
{
   favEdit->changeFavoriteReset_Button->setEnabled(true);
   currentFavoriteSet = true;
   currentImageName = favEdit->currentFavoriteFourHidden_Label->text();
   setCurrentFavoriteForChange();
   activateApplyChangesButton();
   currentFavoriteSelected = 4;
}

void FavoritesEdit::on_currentFavoriteFive_Button_clicked()
{
   favEdit->changeFavoriteReset_Button->setEnabled(true);
   currentFavoriteSet = true;
   currentImageName = favEdit->currentFavoriteFiveHidden_Label->text();
   setCurrentFavoriteForChange();
   activateApplyChangesButton();
   currentFavoriteSelected = 5;
}

void FavoritesEdit::on_currentFavoriteSix_Button_clicked()
{
   favEdit->changeFavoriteReset_Button->setEnabled(true);
   currentFavoriteSet = true;
   currentImageName = favEdit->currentFavoriteSixHidden_Label->text();
   setCurrentFavoriteForChange();
   activateApplyChangesButton();
   currentFavoriteSelected = 6;
}

//Based upon what value was saved in the hidden label the appropriate image will be displayed in the set current for change label
void FavoritesEdit::setCurrentFavoriteForChange()
{
        if((currentImageName == "facebook") || (currentImageName == "myspace") || (currentImageName == "youtube") || (currentImageName == "twitter"))
            favEdit->currentFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/websites/images/favoritesImages/websites/" + currentImageName + ".png")));
        else if((currentImageName == "firefox") || (currentImageName == "ie") || (currentImageName == "yahoo") || (currentImageName == "ebay"))
            favEdit->currentFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/websites/images/favoritesImages/websites/" + currentImageName + ".png")));
        else if((currentImageName == "gmail") || (currentImageName == "aolmail") || (currentImageName == "yahoomail") || (currentImageName == "windowslive"))
            favEdit->currentFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/email/images/favoritesImages/email/" + currentImageName + ".png")));
        else if((currentImageName == "aim") || (currentImageName == "msn") || (currentImageName == "pidgin") || (currentImageName == "skype"))
            favEdit->currentFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/chat/images/favoritesImages/chat/" + currentImageName + ".png")));
        else if((currentImageName == "vlc") || (currentImageName == "wmp") || (currentImageName == "itunes") || (currentImageName == "quicktime"))
            favEdit->currentFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/multimedia/images/favoritesImages/multimedia/" + currentImageName + ".png")));
        else if((currentImageName == "email") || (currentImageName == "word") || (currentImageName == "powerpoint") || (currentImageName == "excel"))
            favEdit->currentFavoriteDisplay_Label->setPixmap(QPixmap(QString(":/favoritesImages/school/images/favoritesImages/school/" + currentImageName + ".png")));
        else
            favEdit->currentFavoriteDisplay_Label->setPixmap(QPixmap(QString(currentImageName)));
}

//If the user has selected a current and existing or custom favorite to swap then the apply button is enabled
void FavoritesEdit::activateApplyChangesButton()
{
    if(((existingFavoriteSet == true) && (currentFavoriteSet == true)) || ((newFavoriteSet == true) && (currentFavoriteSet == true)))
        favEdit->applyFavoritesChanges_Button->setEnabled(true);
}

//Once the apply button is clicked the appropriate changes below will take effect updating not only the current preview of the Quick Launch window but also the
//Quick Launch window in itself will be updated
void FavoritesEdit::applyNewFavoriteChanges()
{
    switch(currentFavoriteSelected)
    {
        case 1:
            if(existingSelected == true)
            {
                setQuickLaunch->checkIfWebsiteFav1 = website;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteOneHidden_Label->setText(existingFavoriteName);
                //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteOnePathHidden_Label->setText(favEdit->useExisting_LineEdit->text());
                setQuickLaunch->fav1 = favEdit->useExisting_LineEdit->text();
                //Set the image of the new favorite to the appropriate current selected label
                if((existingFavoriteName == "facebook") || (existingFavoriteName == "myspace") || (existingFavoriteName == "youtube") || (existingFavoriteName == "twitter"))
                {
                    favEdit->currentFavoriteOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "firefox") || (existingFavoriteName == "ie") || (existingFavoriteName == "yahoo") || (existingFavoriteName == "ebay"))
                {
                    favEdit->currentFavoriteOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "gmail") || (existingFavoriteName == "aolmail") || (existingFavoriteName == "yahoomail") || (existingFavoriteName == "windowslive"))
                {
                    favEdit->currentFavoriteOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "aim") || (existingFavoriteName == "msn") || (existingFavoriteName == "pidgin") || (existingFavoriteName == "skype"))
                {
                    favEdit->currentFavoriteOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "vlc") || (existingFavoriteName == "wmp") || (existingFavoriteName == "itunes") || (existingFavoriteName == "quicktime"))
                {
                    favEdit->currentFavoriteOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "email") || (existingFavoriteName == "word") || (existingFavoriteName == "powerpoint") || (existingFavoriteName == "excel"))
                {
                    favEdit->currentFavoriteOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchOne_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                }
           }
           else
           {
                setQuickLaunch->checkIfWebsiteFav1 = newFavWebsiteCheckSave;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteOneHidden_Label->setText(newFavIconSave);
                 //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteOnePathHidden_Label->setText(newFavPathSave);
                setQuickLaunch->fav1 = newFavPathSave;

                //Set the image of the new favorite to the appropriate current selected label
                favEdit->currentFavoriteOne_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
                setQuickLaunch->quickLaunchWindow->quickLaunchOne_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
            }
            break;
        case 2:
            if(existingSelected == true)
            {
                setQuickLaunch->checkIfWebsiteFav2 = website;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteTwoHidden_Label->setText(existingFavoriteName);
                //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteTwoPathHidden_Label->setText(favEdit->useExisting_LineEdit->text());
                setQuickLaunch->fav2 = favEdit->useExisting_LineEdit->text();
                //Set the image of the new favorite to the appropriate current selected label
                if((existingFavoriteName == "facebook") || (existingFavoriteName == "myspace") || (existingFavoriteName == "youtube") || (existingFavoriteName == "twitter"))
                {
                    favEdit->currentFavoriteTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "firefox") || (existingFavoriteName == "ie") || (existingFavoriteName == "yahoo") || (existingFavoriteName == "ebay"))
                {
                    favEdit->currentFavoriteTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "gmail") || (existingFavoriteName == "aolmail") || (existingFavoriteName == "yahoomail") || (existingFavoriteName == "windowslive"))
                {
                    favEdit->currentFavoriteTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "aim") || (existingFavoriteName == "msn") || (existingFavoriteName == "pidgin") || (existingFavoriteName == "skype"))
                {
                    favEdit->currentFavoriteTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "vlc") || (existingFavoriteName == "wmp") || (existingFavoriteName == "itunes") || (existingFavoriteName == "quicktime"))
                {
                    favEdit->currentFavoriteTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "email") || (existingFavoriteName == "word") || (existingFavoriteName == "powerpoint") || (existingFavoriteName == "excel"))
                {
                    favEdit->currentFavoriteTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchTwo_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                }
            }
            else
            {
                setQuickLaunch->checkIfWebsiteFav2 = newFavWebsiteCheckSave;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteTwoHidden_Label->setText(newFavIconSave);
                 //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteTwoPathHidden_Label->setText(newFavPathSave);
                setQuickLaunch->fav2 = newFavPathSave;

                //Set the image of the new favorite to the appropriate current selected label
                favEdit->currentFavoriteTwo_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
                setQuickLaunch->quickLaunchWindow->quickLaunchTwo_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
            }
            break;
        case 3:
            if(existingSelected == true)
            {
                setQuickLaunch->checkIfWebsiteFav3 = website;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteThreeHidden_Label->setText(existingFavoriteName);
                //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteThreePathHidden_Label->setText(favEdit->useExisting_LineEdit->text());
                setQuickLaunch->fav3 = favEdit->useExisting_LineEdit->text();
                //Set the image of the new favorite to the appropriate current selected label
                if((existingFavoriteName == "facebook") || (existingFavoriteName == "myspace") || (existingFavoriteName == "youtube") || (existingFavoriteName == "twitter"))
                {
                    favEdit->currentFavoriteThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "firefox") || (existingFavoriteName == "ie") || (existingFavoriteName == "yahoo") || (existingFavoriteName == "ebay"))
                {
                    favEdit->currentFavoriteThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "gmail") || (existingFavoriteName == "aolmail") || (existingFavoriteName == "yahoomail") || (existingFavoriteName == "windowslive"))
                {
                    favEdit->currentFavoriteThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "aim") || (existingFavoriteName == "msn") || (existingFavoriteName == "pidgin") || (existingFavoriteName == "skype"))
                {
                    favEdit->currentFavoriteThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "vlc") || (existingFavoriteName == "wmp") || (existingFavoriteName == "itunes") || (existingFavoriteName == "quicktime"))
                {
                    favEdit->currentFavoriteThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "email") || (existingFavoriteName == "word") || (existingFavoriteName == "powerpoint") || (existingFavoriteName == "excel"))
                {
                    favEdit->currentFavoriteThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchThree_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                }
            }
            else
            {
                setQuickLaunch->checkIfWebsiteFav3 = newFavWebsiteCheckSave;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteThreeHidden_Label->setText(newFavIconSave);
                 //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteThreePathHidden_Label->setText(newFavPathSave);
                setQuickLaunch->fav3 = newFavPathSave;

                //Set the image of the new favorite to the appropriate current selected label
                favEdit->currentFavoriteThree_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
                setQuickLaunch->quickLaunchWindow->quickLaunchThree_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
            }
            break;
        case 4:
            if(existingSelected == true)
            {
                setQuickLaunch->checkIfWebsiteFav4 = website;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteFourHidden_Label->setText(existingFavoriteName);
                //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteFourPathHidden_Label->setText(favEdit->useExisting_LineEdit->text());
                setQuickLaunch->fav4 = favEdit->useExisting_LineEdit->text();
                //Set the image of the new favorite to the appropriate current selected label
                if((existingFavoriteName == "facebook") || (existingFavoriteName == "myspace") || (existingFavoriteName == "youtube") || (existingFavoriteName == "twitter"))
                {
                    favEdit->currentFavoriteFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "firefox") || (existingFavoriteName == "ie") || (existingFavoriteName == "yahoo") || (existingFavoriteName == "ebay"))
                {
                    favEdit->currentFavoriteFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "gmail") || (existingFavoriteName == "aolmail") || (existingFavoriteName == "yahoomail") || (existingFavoriteName == "windowslive"))
                {
                    favEdit->currentFavoriteFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "aim") || (existingFavoriteName == "msn") || (existingFavoriteName == "pidgin") || (existingFavoriteName == "skype"))
                {
                    favEdit->currentFavoriteFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "vlc") || (existingFavoriteName == "wmp") || (existingFavoriteName == "itunes") || (existingFavoriteName == "quicktime"))
                {
                    favEdit->currentFavoriteFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "email") || (existingFavoriteName == "word") || (existingFavoriteName == "powerpoint") || (existingFavoriteName == "excel"))
                {
                    favEdit->currentFavoriteFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFour_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                }
            }
            else
            {
                setQuickLaunch->checkIfWebsiteFav4 = newFavWebsiteCheckSave;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteFourHidden_Label->setText(newFavIconSave);
                 //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteFourPathHidden_Label->setText(newFavPathSave);
                setQuickLaunch->fav4 = newFavPathSave;

                //Set the image of the new favorite to the appropriate current selected label
                favEdit->currentFavoriteFour_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
                setQuickLaunch->quickLaunchWindow->quickLaunchFour_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
            }
            break;
        case 5:
            if(existingSelected == true)
            {
                setQuickLaunch->checkIfWebsiteFav5 = website;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteFiveHidden_Label->setText(existingFavoriteName);
                //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteFivePathHidden_Label->setText(favEdit->useExisting_LineEdit->text());
                setQuickLaunch->fav5 = favEdit->useExisting_LineEdit->text();
                //Set the image of the new favorite to the appropriate current selected label
                if((existingFavoriteName == "facebook") || (existingFavoriteName == "myspace") || (existingFavoriteName == "youtube") || (existingFavoriteName == "twitter"))
                {
                    favEdit->currentFavoriteFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "firefox") || (existingFavoriteName == "ie") || (existingFavoriteName == "yahoo") || (existingFavoriteName == "ebay"))
                {
                    favEdit->currentFavoriteFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "gmail") || (existingFavoriteName == "aolmail") || (existingFavoriteName == "yahoomail") || (existingFavoriteName == "windowslive"))
                {
                    favEdit->currentFavoriteFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "aim") || (existingFavoriteName == "msn") || (existingFavoriteName == "pidgin") || (existingFavoriteName == "skype"))
                {
                    favEdit->currentFavoriteFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "vlc") || (existingFavoriteName == "wmp") || (existingFavoriteName == "itunes") || (existingFavoriteName == "quicktime"))
                {
                    favEdit->currentFavoriteFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "email") || (existingFavoriteName == "word") || (existingFavoriteName == "powerpoint") || (existingFavoriteName == "excel"))
                {
                    favEdit->currentFavoriteFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchFive_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                }
            }
            else
            {
                setQuickLaunch->checkIfWebsiteFav5 = newFavWebsiteCheckSave;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteFiveHidden_Label->setText(newFavIconSave);
                 //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteFivePathHidden_Label->setText(newFavPathSave);
                setQuickLaunch->fav5 = newFavPathSave;

                //Set the image of the new favorite to the appropriate current selected label
                favEdit->currentFavoriteFive_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
                setQuickLaunch->quickLaunchWindow->quickLaunchFive_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
            }
            break;
        case 6:
            if(existingSelected == true)
            {
                setQuickLaunch->checkIfWebsiteFav6 = website;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteSixHidden_Label->setText(existingFavoriteName);
                //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteSixPathHidden_Label->setText(favEdit->useExisting_LineEdit->text());
                setQuickLaunch->fav6 = favEdit->useExisting_LineEdit->text();
                //Set the image of the new favorite to the appropriate current selected label
                if((existingFavoriteName == "facebook") || (existingFavoriteName == "myspace") || (existingFavoriteName == "youtube") || (existingFavoriteName == "twitter"))
                {
                    favEdit->currentFavoriteSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "firefox") || (existingFavoriteName == "ie") || (existingFavoriteName == "yahoo") || (existingFavoriteName == "ebay"))
                {
                    favEdit->currentFavoriteSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/websites/images/favoritesImages/websites/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "gmail") || (existingFavoriteName == "aolmail") || (existingFavoriteName == "yahoomail") || (existingFavoriteName == "windowslive"))
                {
                    favEdit->currentFavoriteSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/email/images/favoritesImages/email/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "aim") || (existingFavoriteName == "msn") || (existingFavoriteName == "pidgin") || (existingFavoriteName == "skype"))
                {
                    favEdit->currentFavoriteSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/chat/images/favoritesImages/chat/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "vlc") || (existingFavoriteName == "wmp") || (existingFavoriteName == "itunes") || (existingFavoriteName == "quicktime"))
                {
                    favEdit->currentFavoriteSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/multimedia/images/favoritesImages/multimedia/" + existingFavoriteName + ".png)}");
                }
                else if((existingFavoriteName == "email") || (existingFavoriteName == "word") || (existingFavoriteName == "powerpoint") || (existingFavoriteName == "excel"))
                {
                    favEdit->currentFavoriteSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                    setQuickLaunch->quickLaunchWindow->quickLaunchSix_Button->setStyleSheet("QPushButton{background-image: url(:/favoritesImages/school/images/favoritesImages/school/" + existingFavoriteName + ".png)}");
                }
            }
            else
            {
                setQuickLaunch->checkIfWebsiteFav6 = newFavWebsiteCheckSave;
                //Set the hidden label to the new image name so that the new current favorite will be saved
                favEdit->currentFavoriteSixHidden_Label->setText(newFavIconSave);
                 //Set the path of the new favorite to the appropriate current selected text edit
                favEdit->currentFavoriteSixPathHidden_Label->setText(newFavPathSave);
                setQuickLaunch->fav6 = newFavPathSave;

                //Set the image of the new favorite to the appropriate current selected label
                favEdit->currentFavoriteSix_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
                setQuickLaunch->quickLaunchWindow->quickLaunchSix_Button->setStyleSheet("QPushButton{background-image: url(" + newFavIconSave + ")}");
            }
            break;
    }

    //Set the Apply button back to false aka disabled
    favEdit->applyFavoritesChanges_Button->setEnabled(false);

    //Set the bools back to false so that the user must click a new favorite and new existing in order for the Apply button to be enabled
    currentFavoriteSet = false;
    existingFavoriteSet = false;
    newFavoriteSet = false;

    //Clear both the current and new selected labels so the user is aware the process is complete
    favEdit->currentFavoriteDisplay_Label->clear();
    favEdit->newFavoriteDisplay_Label->clear();

    if(existingSelected == false)
    {
        favEdit->newUse_Button->setEnabled(false);
        favEdit->newEdit_Button->setEnabled(false);
    }
}

//Disable certain buttons if the user chooses to edit an existing favorite
void FavoritesEdit::editExistingFavorite()
{
    favEdit->useExistingTestEdit_Button->setEnabled(true);
    favEdit->useExistingTest_Button->setEnabled(false);
    favEdit->useExistingSave_Button->setEnabled(false);
}

//Test to ensure the edited existing favorite works correctly
void FavoritesEdit::testEditedExistingPath()
{   
    if(website == true)
    {
        QDesktopServices::openUrl(QUrl(existingFavoritePath));
    }
    else
    {
        program = favEdit->useExisting_LineEdit->text();
        QProcess *myProcess = new QProcess();
        myProcess->start(program, arguments);

        if (myProcess->error() == QProcess::FailedToStart)
        {
            QMessageBox::critical( 0, tr("Error"), tr("Could not find the correct path to run. If the path has been updated proceed to Add New to search for the new path"), tr("Ok") );
            favEdit->useExistingSaveEdit_Button->setEnabled(false);
        }
        else
            favEdit->useExistingSaveEdit_Button->setEnabled(true);
    }
}

//Based upon what existing favortie is being edited, save the new updated path in it's appropriate string
void FavoritesEdit::saveEditedExistingPath()
{
    if(existingFavoriteName == "firefox")
    {
        firefox = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "ie")
    {
        ie = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "aim")
    {
        aim = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "msn")
    {
        msn = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "pidgin")
    {
        pidgin = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "skype")
    {
        skype = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "vlc")
    {
        vlc = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "wmp")
    {
        wmp = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "itunes")
    {
        itunes = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "quicktime")
    {
        quicktime = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "word")
    {
        word = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "powerpoint")
    {
        powerpoint = favEdit->useExisting_LineEdit->text();
    }
    else if(existingFavoriteName == "excel")
    {
        excel = favEdit->useExisting_LineEdit->text();
    }

    setExistingDefaultButtons();
}

//Restore default existing favorite buttons
void FavoritesEdit::setExistingDefaultButtons()
{
    favEdit->useExistingTestEdit_Button->setEnabled(false);
    favEdit->useExistingSaveEdit_Button->setEnabled(false);
    favEdit->useExistingSave_Button->setEnabled(true);
    favEdit->useExistingTest_Button->setEnabled(true);
}

//If the user chooses to reset their change favorites selection then the buttons below will be disabled and the labels cleared
void FavoritesEdit::on_changeFavoriteReset_Button_clicked()
{
    //Set the Apply button back to false aka disabled
    favEdit->applyFavoritesChanges_Button->setEnabled(false);

    //Set the bools back to false so that the user must click a new favorite and new existing in order for the Apply button to be enabled
    currentFavoriteSet = false;
    existingFavoriteSet = false;
    newFavoriteSet = false;

    //Clear both the current and new selected labels so the user is aware the process is complete
    favEdit->currentFavoriteDisplay_Label->clear();
    favEdit->newFavoriteDisplay_Label->clear();

    //Set the Reset button back to false
    favEdit->changeFavoriteReset_Button->setEnabled(false);

    //Set the use/edit buttons of new back to false
    favEdit->newUse_Button->setEnabled(false);
    favEdit->newEdit_Button->setEnabled(false);
}

//If the user clicks the Website button then disable and clear the Application lineEdit and enable the Website lineEdit
void FavoritesEdit::on_newWebsitePath_Button_clicked()
{
    favEdit->newApplicationPath_LineEdit->setEnabled(false);
    favEdit->newApplicationPath_LineEdit->clear();
    favEdit->newWebsitePath_LineEdit->setEnabled(true);
    website = true;
}

//If the user clicks the Application button then disable and clear the Website lineEdit and enable the Application lineEdit
//Also let the user open a fileDialog
void FavoritesEdit::on_newApplicationPath_Button_clicked()
{
    favEdit->newWebsitePath_LineEdit->setEnabled(false); 
    favEdit->newWebsitePath_LineEdit->clear();
    website = false;

    fileAppOpen = QFileDialog::getOpenFileName(this, tr("Find Application"), QDir::currentPath(), tr("Applications (*.exe)"));

    if(!fileAppOpen.isNull())
    {
        favEdit->newApplicationPath_LineEdit->setEnabled(true);
    }

    favEdit->newApplicationPath_LineEdit->setText(fileAppOpen);
}

//If text is entered in either the Website lineEdit or the Application lineEdit then the newTest_Button is enabled
void FavoritesEdit::testNewFavorite()
{
    favEdit->newTest_Button->setEnabled(true);
}

//When the user presses the test button it will test the website or application to ensure it runs correctly.
void FavoritesEdit::on_newTest_Button_clicked()
{
    if(website == true)
    {
        QUrl test = favEdit->newWebsitePath_LineEdit->text();
        
        QDesktopServices::openUrl(test);

        if(newCustomCount != 4)
            favEdit->newSave_Button->setEnabled(true);
    }
    else
    {
        program = favEdit->newApplicationPath_LineEdit->text();
        QProcess *myProcess = new QProcess();
        myProcess->start(program, arguments);

        if (myProcess->error() == QProcess::FailedToStart)
        {
            QMessageBox::critical( 0, tr("Error"), tr("Could not find the correct path to run."), tr("Ok") );
            favEdit->newSave_Button->setEnabled(false);
        }
        else
        {
            if(newCustomCount != 4)
                favEdit->newSave_Button->setEnabled(true);
        }
    }
}

//When the user clicks the save button set the test and save button back to disabled, and clear/disable the lineEdits
//If the user has less than 4 custom items then a new item is created and added to the table based on the user's input
//The row and customCount is incremented by 1
void FavoritesEdit::on_newSave_Button_clicked()
{
    if(newCustomCount < 4)
    {
        QTableWidgetItem *newItem = new QTableWidgetItem;

        icon.addFile(QString(fileOpen), QSize(), QIcon::Disabled, QIcon::Off);
        newItem->setIcon(icon);

        newItem->setText(favEdit->newName_LineEdit->text());

        favEdit->new_TableWidget->setItem(newRow, 0, newItem);

        switch(newCustomCount)
        {
            case 0:
                newFavIconOne = fileOpen;
                break;
            case 1:
                newFavIconTwo = fileOpen;
                break;
            case 2:
                newFavIconThree = fileOpen;
                break;
            case 3:
                newFavIconFour = fileOpen;
                break;
        }
    }
    else
        QMessageBox::critical( 0, tr("Error"), tr("Max Custom Favorites Reached."), tr("Ok") );

    favEdit->newTest_Button->setEnabled(false);
    favEdit->newSave_Button->setEnabled(false);
    favEdit->newIconDisplay_Button->setStyleSheet("QPushButton{background: none}");
    favEdit->newName_LineEdit->clear();

    if(website == true)
    {
        switch(newRow)
        {
            case 0:
                newFavPathOne = favEdit->newWebsitePath_LineEdit->text();
                websiteFavOne = true;
                break;
            case 1:
                newFavPathTwo = favEdit->newWebsitePath_LineEdit->text();
                websiteFavTwo = true;
                break;
            case 2:
                newFavPathThree = favEdit->newWebsitePath_LineEdit->text();
                websiteFavThree = true;
                break;
            case 3:
                newFavPathFour = favEdit->newWebsitePath_LineEdit->text();
                websiteFavFour = true;
                break;
        }

        favEdit->newWebsitePath_LineEdit->setEnabled(false);
        favEdit->newWebsitePath_LineEdit->clear();
    }
    else
    {
        switch(newRow)
        {
            case 0:
                newFavPathOne = favEdit->newApplicationPath_LineEdit->text();
                websiteFavOne = false;
                break;
            case 1:
                newFavPathTwo = favEdit->newApplicationPath_LineEdit->text();
                websiteFavTwo = false;
                break;
            case 2:
                newFavPathThree = favEdit->newApplicationPath_LineEdit->text();
                websiteFavThree = false;
                break;
            case 3:
                newFavPathFour = favEdit->newApplicationPath_LineEdit->text();
                websiteFavFour = false;
                break;
        }

        favEdit->newApplicationPath_LineEdit->setEnabled(false);
        favEdit->newApplicationPath_LineEdit->clear();
    }

    newRow += 1;
    newCustomCount += 1;
}

//If the user clicks the new Icon button they are able to search for a png or jpg image to use for their custom favorite
void FavoritesEdit::on_newIcon_Button_clicked()
{
    fileOpen = QFileDialog::getOpenFileName(this, tr("Find Image"), QDir::currentPath(), tr("Images (*.png)"));

    favEdit->newIconDisplay_Button->setStyleSheet("QPushButton{background-image: url(" + fileOpen + ")}");
}

//When the user has selected a new custom favorite to use then the favorite is seen under the change new favorite and lineEdits are cleared
void FavoritesEdit::useNewFavoriteSelected(int Row, int Column)
{
    favEdit->newWebsitePath_LineEdit->clear();
    favEdit->newApplicationPath_LineEdit->clear();

    favEdit->newUse_Button->setEnabled(true);

    if(Column == 0)
    {
        switch(Row)
        {
            case 0:
                if(favEdit->new_TableWidget->item(0, 0))
                {
                    if(websiteFavOne == true)
                        favEdit->newWebsitePath_LineEdit->setText(newFavPathOne);
                    else
                        favEdit->newApplicationPath_LineEdit->setText(newFavPathOne);

                    favEdit->newName_LineEdit->setText(favEdit->new_TableWidget->item(0, 0)->text());
                }
                break;
            case 1:
                if(favEdit->new_TableWidget->item(1, 0))
                {
                    if(websiteFavTwo == true)
                        favEdit->newWebsitePath_LineEdit->setText(newFavPathTwo);
                    else
                        favEdit->newApplicationPath_LineEdit->setText(newFavPathTwo);

                    favEdit->newName_LineEdit->setText(favEdit->new_TableWidget->item(1, 0)->text());
                }
                break;
            case 2:
                if(favEdit->new_TableWidget->item(2, 0))
                {
                    if(websiteFavThree == true)
                        favEdit->newWebsitePath_LineEdit->setText(newFavPathThree);
                    else
                        favEdit->newApplicationPath_LineEdit->setText(newFavPathThree);

                    favEdit->newName_LineEdit->setText(favEdit->new_TableWidget->item(2, 0)->text());
                }
                break;
            case 3:
                if(favEdit->new_TableWidget->item(3, 0))
                {
                    if(websiteFavFour == true)
                        favEdit->newWebsitePath_LineEdit->setText(newFavPathFour);
                    else
                        favEdit->newApplicationPath_LineEdit->setText(newFavPathFour);

                    favEdit->newName_LineEdit->setText(favEdit->new_TableWidget->item(3, 0)->text());
                }
                break;
        }
    }

    if(newCustomCount == 4)
        favEdit->newEdit_Button->setEnabled(true);
}

void FavoritesEdit::on_newUse_Button_clicked()
{
    favEdit->changeFavoriteReset_Button->setEnabled(true);
    newFavoriteSet = true;
    activateApplyChangesButton();

    existingSelected = false;

    if(favEdit->new_TableWidget->item(0, 0)->isSelected())
    {
        newFavIconSave = newFavIconOne;
        newFavPathSave = newFavPathOne;
        newFavWebsiteCheckSave = websiteFavOne;

        favEdit->newFavoriteDisplay_Label->setPixmap(QPixmap(QString(newFavIconSave)));
    }
    else if(favEdit->new_TableWidget->item(1, 0)->isSelected())
    {
        newFavIconSave = newFavIconTwo;
        newFavPathSave = newFavPathTwo;
        newFavWebsiteCheckSave = websiteFavTwo;

        favEdit->newFavoriteDisplay_Label->setPixmap(QPixmap(QString(newFavIconSave)));
    }
    else if(favEdit->new_TableWidget->item(2, 0)->isSelected())
    {
        newFavIconSave = newFavIconThree;
        newFavPathSave = newFavPathThree;
        newFavWebsiteCheckSave = websiteFavThree;

        favEdit->newFavoriteDisplay_Label->setPixmap(QPixmap(QString(newFavIconSave)));
    }
    else if(favEdit->new_TableWidget->item(3, 0)->isSelected())
    {
        newFavIconSave = newFavIconFour;
        newFavPathSave = newFavPathFour;
        newFavWebsiteCheckSave = websiteFavFour;

        favEdit->newFavoriteDisplay_Label->setPixmap(QPixmap(QString(newFavIconSave)));
    }
}

//When the user updates an existing new custom favorite all characteristics of that favorite item are updated as well
void FavoritesEdit::on_newEdit_Button_clicked()
{
    favEdit->newUse_Button->setEnabled(false);

    if(favEdit->new_TableWidget->item(0, 0)->isSelected())
    {
        if(website == true)
        {
            websiteFavOne = true;
            newFavPathOne = favEdit->newWebsitePath_LineEdit->text();
        }
        else
        {
            websiteFavOne = false;
            newFavPathOne = favEdit->newApplicationPath_LineEdit->text();
        }

        icon.addFile(QString(fileOpen), QSize(), QIcon::Normal, QIcon::Off);
        favEdit->new_TableWidget->item(0, 0)->setIcon(icon);
        newFavIconOne = fileOpen;
        favEdit->new_TableWidget->item(0, 0)->setText(favEdit->newName_LineEdit->text());
    }
    else if(favEdit->new_TableWidget->item(1, 0)->isSelected())
    {
        if(website == true)
        {
            websiteFavTwo = true;
            newFavPathTwo = favEdit->newWebsitePath_LineEdit->text();
        }
        else
        {
            websiteFavTwo = false;
            newFavPathTwo = favEdit->newApplicationPath_LineEdit->text();
        }

        icon.addFile(QString(fileOpen), QSize(), QIcon::Normal, QIcon::Off);
        favEdit->new_TableWidget->item(1, 0)->setIcon(icon);
        newFavIconTwo = fileOpen;
        favEdit->new_TableWidget->item(1, 0)->setText(favEdit->newName_LineEdit->text());
    }
    else if(favEdit->new_TableWidget->item(2, 0)->isSelected())
    {
        if(website == true)
        {
            websiteFavThree = true;
            newFavPathThree = favEdit->newWebsitePath_LineEdit->text();
        }
        else
        {
            websiteFavThree = false;
            newFavPathThree = favEdit->newApplicationPath_LineEdit->text();
        }

        icon.addFile(QString(fileOpen), QSize(), QIcon::Normal, QIcon::Off);
        favEdit->new_TableWidget->item(2, 0)->setIcon(icon);
        newFavIconThree = fileOpen;
        favEdit->new_TableWidget->item(2, 0)->setText(favEdit->newName_LineEdit->text());
    }
    else if(favEdit->new_TableWidget->item(3, 0)->isSelected())
    {
        if(website == true)
        {
            websiteFavFour = true;
            newFavPathFour = favEdit->newWebsitePath_LineEdit->text();
        }
        else
        {
            websiteFavFour = false;
            newFavPathFour = favEdit->newApplicationPath_LineEdit->text();
        }

        icon.addFile(QString(fileOpen), QSize(), QIcon::Normal, QIcon::Off);
        favEdit->new_TableWidget->item(3, 0)->setIcon(icon);
        newFavIconFour = fileOpen;
        favEdit->new_TableWidget->item(3, 0)->setText(favEdit->newName_LineEdit->text());
    }

    favEdit->newEdit_Button->setEnabled(false);
    favEdit->newTest_Button->setEnabled(false);
    favEdit->newName_LineEdit->clear();
    favEdit->newIconDisplay_Button->setStyleSheet("QPushButton{background: none}");

    if(website == true)
    {
        favEdit->newWebsitePath_LineEdit->setEnabled(false);
        favEdit->newWebsitePath_LineEdit->clear();
    }
    else
    {
        favEdit->newApplicationPath_LineEdit->setEnabled(false);
        favEdit->newApplicationPath_LineEdit->clear();
    }
}

FavoritesEdit::~FavoritesEdit()
{
    delete favEdit;
}

void FavoritesEdit::on_closeFavoritesEdit_Button_clicked()
{
    FavoritesEdit::close();
}
